package com.wwwarehouse.resource_center.bean.goods;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Joseph on 2017/9/19.
 *         <p/>
 *         属性
 */

public class GoodsAttributesBean implements Parcelable {

    /**
     * list : [{"attributeName":"尺寸","attributeUkid":22092500000001042,"attributeValue":"32寸","createTime":"2017-09-24 18:05:36","createUserId":100013591010,"isSelect":false,"metaAttributeUkid":22092300000001044,"updateTime":"2017-09-24 18:05:36","updateUserId":100013591010}]
     * page : 1
     * size : 24
     * total : 50
     */

    private int page;
    private int size;
    private int total;
    private List<ListBean> list;

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public List<ListBean> getList() {
        return list;
    }

    public void setList(List<ListBean> list) {
        this.list = list;
    }

    public static class ListBean implements Parcelable {
        /**
         * attributeName : 尺寸
         * attributeUkid : 22092500000001042
         * attributeValue : 32寸
         * createTime : 2017-09-24 18:05:36
         * createUserId : 100013591010
         * isSelect : false
         * metaAttributeUkid : 22092300000001044
         * updateTime : 2017-09-24 18:05:36
         * updateUserId : 100013591010
         */

        private String attributeName="";
        private long attributeUkid;
        private String attributeValue="";
        private String createTime;
        private long createUserId;
        private boolean isSelect = false;  //是否选中
        private long metaAttributeUkid;
        private String updateTime;
        private long updateUserId;
        private boolean isFromCategory = false ; //类目下的属性必选

        public boolean isFromCategory() {
            return isFromCategory;
        }

        public void setFromCategory(boolean fromCategory) {
            isFromCategory = fromCategory;
        }

        public static Creator<ListBean> getCREATOR() {
            return CREATOR;
        }

        public String getAttributeName() {
            return attributeName;
        }

        public void setAttributeName(String attributeName) {
            this.attributeName = attributeName;
        }

        public long getAttributeUkid() {
            return attributeUkid;
        }

        public void setAttributeUkid(long attributeUkid) {
            this.attributeUkid = attributeUkid;
        }

        public String getAttributeValue() {
            return attributeValue;
        }

        public void setAttributeValue(String attributeValue) {
            this.attributeValue = attributeValue;
        }

        public String getCreateTime() {
            return createTime;
        }

        public void setCreateTime(String createTime) {
            this.createTime = createTime;
        }

        public long getCreateUserId() {
            return createUserId;
        }

        public void setCreateUserId(long createUserId) {
            this.createUserId = createUserId;
        }

        public boolean isSelect() {
            return isSelect;
        }

        public void setSelect(boolean isSelect) {
            this.isSelect = isSelect;
        }

        public long getMetaAttributeUkid() {
            return metaAttributeUkid;
        }

        public void setMetaAttributeUkid(long metaAttributeUkid) {
            this.metaAttributeUkid = metaAttributeUkid;
        }

        public String getUpdateTime() {
            return updateTime;
        }

        public void setUpdateTime(String updateTime) {
            this.updateTime = updateTime;
        }

        public long getUpdateUserId() {
            return updateUserId;
        }

        public void setUpdateUserId(long updateUserId) {
            this.updateUserId = updateUserId;
        }

        public ListBean() {
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.attributeName);
            dest.writeLong(this.attributeUkid);
            dest.writeString(this.attributeValue);
            dest.writeString(this.createTime);
            dest.writeLong(this.createUserId);
            dest.writeByte(this.isSelect ? (byte) 1 : (byte) 0);
            dest.writeLong(this.metaAttributeUkid);
            dest.writeString(this.updateTime);
            dest.writeLong(this.updateUserId);
            dest.writeByte(this.isFromCategory ? (byte) 1 : (byte) 0);
        }

        protected ListBean(Parcel in) {
            this.attributeName = in.readString();
            this.attributeUkid = in.readLong();
            this.attributeValue = in.readString();
            this.createTime = in.readString();
            this.createUserId = in.readLong();
            this.isSelect = in.readByte() != 0;
            this.metaAttributeUkid = in.readLong();
            this.updateTime = in.readString();
            this.updateUserId = in.readLong();
            this.isFromCategory = in.readByte() != 0;
        }

        public static final Creator<ListBean> CREATOR = new Creator<ListBean>() {
            @Override
            public ListBean createFromParcel(Parcel source) {
                return new ListBean(source);
            }

            @Override
            public ListBean[] newArray(int size) {
                return new ListBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.page);
        dest.writeInt(this.size);
        dest.writeInt(this.total);
        dest.writeList(this.list);
    }

    public GoodsAttributesBean() {
    }

    protected GoodsAttributesBean(Parcel in) {
        this.page = in.readInt();
        this.size = in.readInt();
        this.total = in.readInt();
        this.list = new ArrayList<ListBean>();
        in.readList(this.list, ListBean.class.getClassLoader());
    }

    public static final Parcelable.Creator<GoodsAttributesBean> CREATOR = new Parcelable.Creator<GoodsAttributesBean>() {
        @Override
        public GoodsAttributesBean createFromParcel(Parcel source) {
            return new GoodsAttributesBean(source);
        }

        @Override
        public GoodsAttributesBean[] newArray(int size) {
            return new GoodsAttributesBean[size];
        }
    };
}
